"""
class ClassName(MiddlewareMixin):
"""
from django.utils.deprecation import MiddlewareMixin


class TestMiddleware(MiddlewareMixin):

    # 在每次请求前 都会调用执行
    def process_request(self, request):
        print('11111111111111process_request')

        # user=request.COOKIES.get('user')
        # if user is not None:
        #     print('登录用户')
        # else:
        #     print('非登录用户')

    # 在每次响应前[响应客户端前] 都会调用执行
    # 在每次响应后[ 我们已经得到了 视图的响应对象]
    # warning : 记得要有 response 的return [返回]
    def process_response(self, request, response):
        print('11111111111111process_response')
        # response['Server']='xxxxx'
        return response


class TestMiddleware2(MiddlewareMixin):

    # 在每次请求前 都会调用执行
    def process_request(self, request):
        print('6666666666666666666666process_request')
        # user=request.COOKIES.get('user')
        # if user is not None:
        #     print('登录用户')
        # else:
        #     print('非登录用户')

    # 在每次响应前[响应客户端前] 都会调用执行
    # 在每次响应后[ 我们已经得到了 视图的响应对象]
    # warning : 记得要有 response 的return [返回]
    def process_response(self, requset, response):
        print('6666666666666666666666process_response')
        # response['Server']='xxxxx'
        return response
